package com.whfc.fmam.controller;

import com.whfc.common.result.Result;
import com.whfc.common.result.ResultUtil;
import com.whfc.fmam.entity.qo.LicenseActiveQO;
import com.whfc.fmam.service.FmamLicenseService;
import org.apache.dubbo.config.annotation.DubboReference;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Description:
 * @author: xugcheng
 * @version: 1.0
 * @date: 2019/10/14 19:33
 */
@RestController
@RequestMapping(value = {"/fmam/api", "/open/api/fmam"})
public class FmamSyncActiveController {

    private Logger logger = LoggerFactory.getLogger(this.getClass());

    @DubboReference(interfaceClass = FmamLicenseService.class, version = "1.0.0")
    FmamLicenseService fmamLicenseService;

    @PostMapping("license/active")
    public Result licenseActive(@RequestBody @Validated LicenseActiveQO licenseActiveQO) {
        logger.info("授权文件激活,licenseActiveQO:[{}]", licenseActiveQO);
        fmamLicenseService.licenseActive(licenseActiveQO);
        return ResultUtil.success();
    }
}
